
// agentAgree(),agentUninstallPop(),agentUninstall(),sendSettingList()

function loginAction(){
    var id = $("#id").attr("value");
    var pw = $("#pw").attr("value");
    console.log("index.control.js >> loginAction id " + id);
    console.log("index.control.js >> loginAction pw " + pw);
    console.log("index.control.js >> loginAction device_id " + device_id);
    loginChk(id,pw,device_id);
}

//쓰이는곳없슴
function loginAction2(){
    var id = $("#id").attr("value");
    var pw = $("#pw").attr("value");
    console.log("index.control.js >>loginAction2 id " + id);
    console.log("index.control.js >>loginAction2 pw " + pw);
    console.log("index.control.js >>loginAction2 device_id " + device_id);
    loginChk2(id,pw,device_id);
}

/*
 
 for(y=0; y < contractListIdxMapAlertNo.size(); y++){
 //console.log("index.control.js >>############## contract : "+contractListIdxMapAlertNo.get(y));
 }
 
 */

//  푸시 알람 받기
document.addEventListener('push-notification', function(event) {
                          var contents = event.notification.aps.alert;
                          
                          console.log(">>>>>>>>>>>>>" + contents);
                          
                          var obj = jQuery.parseJSON( contents );
                          
                          
                          console.log(">>>>>>>>>>>>>" + contents);
                          
                          console.log(">>>>>>>>>>>>>" + obj.agentid + ", " + obj.msg+ ", " + obj.parm);
                          
                          
                          //alert(obj.msg);
                          //$( "#popupBasic010" ).html("<h3>"+ obj.msg+"</h3>" );
                          //$( "#popupBasic01" ).popup( "open" );
                          showAlert(obj.msg,'With U','ok');
                          console.log("showAlert " + obj.msg);
                          pushmsgTxt = obj.msg;
                          pushparmTxt = obj.parm;
                        
                          console.log('index.control.js >> contractListIdxMapAlertNo.get : ' + contractListIdxMapAlertNo.get(obj.agentid));
                          
                          
                          var i = contractListIdxMapAlertNo.get(obj.agentid) + 1;
                          console.log('index.control.js >> i : ' + i);
                          contractListIdxMapAlertNo.put(obj.agentid,i);
                          
                          $("span#noti"+obj.agentid).text(i);
                          $("span#noti"+obj.agentid).attr("style","color: #FFFFFF; background: red;");
                          if(i == null) i =0;
                          var tmp = "";
                          if(obj.agentid ==20) tmp =  "- 혈당예측 알림 (" + i+ ")";
                          if(obj.agentid ==10) tmp =  "- 비만라이프스타일 알림 (" + i+ ")";
                          if(obj.agentid ==37) tmp =  "- 뇌졸중 자가진단 알림 (" + i+ ")";
                          if(obj.agentid ==84) tmp =  "- 다이어트게임 알림 (" + i+ ")";
                          
                          
                          
                          var now = new Date();
                          var output = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' +  now.getDate() +  ' '  + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();
                          //var cont = "<li data-theme='a'></li>";
                          var  cont = "<li data-theme='b'> <a href=javascript:contentsPaging('contents5');iframesrc("+obj.agentid+");>"+tmp+ " "+ output +"</a></li>";
                          
                         
                          
                          $("#pushlistview").append(cont);
                          $("#pushlistview").listview("refresh");
                          
                          contentsScroll('pushlistview0');
                          
                          //navigator.notification.alert(title);
                          });


function openProfile()  {   $( "#popupProfile" ).popup( "open" );   }
function closeProfile() {   $( "#popupProfile" ).popup( "close" );  }
function closeLogin()   {   $( "#popupLogin" ).popup( "close" );    }
function openLogin()    {   $( "#popupLogin" ).popup( "open" );     }


/*a = msg, b = title, c = button name*/
 function showAlert(a,b,c)
{
    navigator.notification.alert(a,null,b,c);
    
    console.log("showAlert a " + a);
    
}
 /**/










